package org.anti996.lms.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.anti996.lms.model.Booking;
import org.anti996.lms.model.Operator;
import org.anti996.lms.mapper.OperatorMapper;
import org.anti996.lms.service.OperatorService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 操作员表 服务实现类
 * </p>
 *
 * @author The Anti996 Authors
 * @since 2022-07-15
 */
@Service
public class OperatorServiceImpl extends ServiceImpl<OperatorMapper, Operator> implements OperatorService {
    @Override//操作员登录
    public boolean login(String username, String password){
        QueryWrapper<Operator> wrapper=new QueryWrapper<>();
        wrapper.eq("username",username);
        wrapper.eq("password",password);
        return baseMapper.exists(wrapper);
    }

    @Override
    public Integer findIdByUsername(String username) {
        return baseMapper.findIdByUsername("%" + username.trim() + "%");
    }

}
